#!/bin/bash
sleep_sec=4d
logs="./nohup.out /usr/local/nginx/logs/error.log /usr/local/nginx/logs/error_l2.log /usr/local/nginx/logs/error_liverobot.log  /usr/local/nginx/logs/access.log"

for log in  $logs 
do
   echo "echo \"\" >$log"
   echo "" > $log
done

cmd=$0
p=${cmd:0:1}
if [ "$p" = "." ] ; then
  curpath=`pwd`
  echo "$curpath/${cmd:2} sleep $sleep_sec(s)"
  echo  -e "\n\n\n\n"
  sleep $sleep_sec
  exec $curpath/${cmd:2}
#elif [ "$p" = "/" ] ; then
else
  echo "$0 sleep $sleep_sec(s)"
  echo  -e "\n\n\n\n"
  sleep $sleep_sec
  exec $0
fi
